package cn.nebula.music.service;

import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.nebula.music.dao.LyricsDAO;
import cn.nebula.music.domain.Lyrics;

@Service
public class LyricsServiceImpl implements LyricsService {

	@Autowired
	private LyricsDAO lyricsDAO;

	@Override
	public Set<Lyrics> findAllLyricses() throws Exception {
		return lyricsDAO.findAllLyricses();
	}

	@Override
	public Set<Lyrics> findAllLyricsesOfBT() throws Exception {
		return lyricsDAO.findAllLyricsesOfBT();
	}

	@Override
	public Lyrics findLyricsById(Integer id) throws Exception {
		return lyricsDAO.findLyricsById(id);
	}

	@Override
	public Lyrics findLyricsByResourcepath(String path) throws Exception {
		return lyricsDAO.findLyricsByResourcepath(path);
	}

	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public void addLyrics(Lyrics lyrics) throws Exception {
		lyricsDAO.addLyrics(lyrics);
	}

	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public void updateLyrics(Lyrics lyrics) throws Exception {
		lyricsDAO.updateLyrics(lyrics);
	}

	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public void deleteLyricsById(Integer id) throws Exception {
		lyricsDAO.deleteLyricsById(id);
	}

}
